﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.ActiveRecord;

namespace Windvoice.Blog
{
    public partial class Link :  ActiveRecordBase<Link>
    {
        public static Link[] GetList(int pageIndex, int pageSize,bool isEnabled, out int recordCount)
        {
            recordCount = FindAll().Where(l => l.IsEnable == isEnabled).Count();
            return FindAll().Where(l => l.IsEnable == isEnabled).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToArray();
        }

        public static Link[] GetList(LinkType linkType)
        {
            var query = from l in FindAll() where l.IsEnable==true && l.Type==(int)linkType select l;
            return query.ToArray();
        }
    }
}
